#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2019/11/21 22:40|22:40
# @Author  : yangdingyi
# @File    : 最大连续1的个数
# @Software: PyCharm
from typing import List


class Solution:
    def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
        ans, m = 0, 0
        for i, n in enumerate(nums):
            if n == 0:
                m = 0
            else:
                m += n
            if m > ans:
                ans = m
        return ans
